Skip to content

[TM] Add spec for AlertManager#24906

Closed
sasurau4 wants to merge 8 commits into
facebook:masterfrom
sasurau4:spec-alertmanager
Closed

[TM] Add spec for AlertManager#24906
sasurau4 wants to merge 8 commits into
facebook:masterfrom
sasurau4:spec-alertmanager

Conversation

@sasurau4
Copy link
Copy Markdown
Contributor

Summary

Part of #24875

Changelog

[General] [Added] - Add TurboModule spec for AlertManager

Test Plan

  • yarn flow

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 16, 2019
Copy link
Copy Markdown

@analysis-bot analysis-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code analysis results:

  • eslint found some issues. Run yarn lint --fix to automatically fix problems.

Comment thread Libraries/Alert/NativeAlertManager.js Outdated
Comment thread Libraries/Alert/NativeAlertManager.js Outdated
Comment thread Libraries/Alert/NativeAlertManager.js Outdated
Comment thread Libraries/Alert/NativeAlertManager.js Outdated
Comment thread Libraries/Alert/NativeAlertManager.js Outdated
Comment thread Libraries/Alert/NativeAlertManager.js Outdated
Comment thread Libraries/Alert/NativeAlertManager.js Outdated
@react-native-bot react-native-bot added API: Alert Type: Enhancement A new feature or enhancement of an existing feature. labels May 16, 2019
@ericlewis ericlewis added the Flow label May 16, 2019
Copy link
Copy Markdown
Contributor

@RSNara RSNara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

But unfortunately, our current Codegen system doesn't support enums or unions. Could you replace them with strings?

Comment thread Libraries/Alert/NativeAlertManager.js Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, our Codegen doesn't support unions. 😔

Comment thread Libraries/Alert/NativeAlertManager.js Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also doesn't support enums. 😔

@sasurau4
Copy link
Copy Markdown
Contributor Author

@RSNara Thanks for reviewing. 👍
I replaced enums and union to string. Please review again 🙏

Comment thread Libraries/Alert/RCTAlertManager.ios.js Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sasurau4,
Could you update its call-sites inside Alert.js, pls?

Also, this is a minor, but should we use import RCTAlertManager from './NativeAlertManager' here instead? I saw many PRs replacing it to this format.

@sasurau4 sasurau4 force-pushed the spec-alertmanager branch from fbceb18 to 2b5b22f Compare May 23, 2019 11:06
@sasurau4
Copy link
Copy Markdown
Contributor Author

@uqmessias Thanks for reviewing 👍
I fixed pointed out. Please review agian 🙏

Comment thread Libraries/Alert/NativeAlertManager.js Outdated
) => void;
}

export default TurboModuleRegistry.getEnforcing<Spec>('AlertManager');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since, this is an iOS only feature, please export it conditionally.

Comment thread Libraries/Alert/NativeAlertManager.js Outdated
Comment thread Libraries/Alert/NativeAlertManager.js
Comment thread Libraries/Alert/NativeAlertManager.js Outdated
@uqmessias
Copy link
Copy Markdown
Contributor

It's almost there, just left a few comments

Comment thread Libraries/Alert/Alert.js Outdated
destructive: string,
}>;
/* 'default' | 'cancel' | 'destructive' */
export type AlertButtonStyle = string;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!
But it would be better to keep this inside the spec file, because there is where we're defining types. We're could still exporting it here too or updating all call-sites that uses these types from here to the spec path.

What do you think about it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with keeping types inside the spec file. I'll move types to spec file 👍

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fkgozali has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Copy Markdown

@analysis-bot analysis-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code analysis results:

  • eslint found some issues. Run yarn lint --fix to automatically fix problems.

Comment thread Libraries/Alert/Alert.js Outdated
@sasurau4
Copy link
Copy Markdown
Contributor Author

@uqmessias Thanks for comments! I worked on it! Plz review 🙏

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fkgozali has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Comment thread Libraries/Alert/Alert.js
type AlertType,
type AlertButtonStyle,
} from './NativeAlertManager';
import {type Buttons, type Options, type AlertType} from './NativeAlertManager';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a minor and no need to update it, but you also can use

import type { Buttons, Options, AlertType } from './NativeAlertManager';

Copy link
Copy Markdown
Contributor

@uqmessias uqmessias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@uqmessias
Copy link
Copy Markdown
Contributor

We still need @RSNara's approval

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @sasurau4 in 122cc8b.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label May 28, 2019
@sasurau4 sasurau4 deleted the spec-alertmanager branch May 28, 2019 06:05
M-i-k-e-l pushed a commit to M-i-k-e-l/react-native that referenced this pull request Mar 10, 2020
Summary:
Part of facebook#24875

## Changelog

[General] [Added] - Add TurboModule spec for AlertManager
Pull Request resolved: facebook#24906

Reviewed By: lunaleaps

Differential Revision: D15471065

Pulled By: fkgozali

fbshipit-source-id: bb22e6454b1f748987f3a8cd957bfd4e027493a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API: Alert CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Flow Merged This PR has been merged. Native Module Type: Enhancement A new feature or enhancement of an existing feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants